home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1997 #1 / Amiga Plus Extra 1997 #1.iso / programme / tools / wincloser / iesupport.a next >
Text File  |  1996-11-25  |  2KB  |  62 lines

  1. *
  2. * Required includes...
  3. *
  4.     INCLUDE    "exec/types.i"
  5.     INCLUDE    "exec/io.i"
  6.     INCLUDE    "devices/inputevent.i"
  7. *
  8. ************************************************************************
  9. *
  10. * Make the entry point external...
  11. *
  12.     xdef    _AlternateCloseWin
  13. *
  14. ************************************************************************
  15. *
  16. * The event list gets passed to you in  a0.
  17. * The is_Data field is passed to you in a1.
  18. * This example does not use the is_Data field...
  19. *
  20. * On exit you must return the event list in d0.  In this way
  21. * you could add or remove items from the event list.
  22. *
  23. ************************************************************************
  24. *
  25. * The handler gets called here...
  26. *
  27.     SECTION _AlternateCloseWin,CODE
  28.  
  29. _AlternateCloseWin:
  30.         move.l    a0,-(sp)    ; Save the event list
  31.         moveq    #$0d,d1        ; RAWKEY for "\"
  32. *
  33. * Since the event list could be a linked list, we start a loop
  34. * here to handle all of the events passed to us.
  35. *
  36. CheckLoop:    cmp.b    #IECLASS_RAWKEY,ie_Class(a0)    ; Get Class...
  37.         bne.s    NextEvent
  38.  
  39.         cmp.w    ie_Code(a0),d1            ; RAWKEY for "\"
  40.         bne.s    NextEvent    
  41.  
  42.         move.w    ie_Qualifier(a0),d0        ; Get qualifiers...
  43.         btst    #IEQUALIFIERB_CONTROL,d0
  44.         beq.s    NextEvent
  45.  
  46.         bchg    #IEQUALIFIERB_CONTROL,d0
  47.         move.w    d0,ie_Qualifier(a0)
  48.  
  49.         move.b    #IECLASS_CLOSEWINDOW,ie_Class(a0)
  50.         clr.w    ie_Code(a0)    
  51.  
  52. NextEvent:    move.l    (a0),d0                ; Get next event
  53.         move.l    d0,a0                ; into a0...
  54.         bne.s    CheckLoop            ; Do some more.
  55. *
  56. * All done, just return the event list...  (in d0)
  57. *
  58.         move.l    (sp)+,d0    ; Get event list back...
  59.         rts            ; return from handler...
  60.  
  61.         END
  62.